#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/hash.h>
#include <linux/gcd.h>
#include <linux/jiffies.h>
#include <linux/proc_fs.h>
#include <asm/param.h>
#include <asm/uaccess.h>

#define BUFFER_SIZE 128
#define PROC_NAME "hello"
// for kernel version 5.6.0 up
#define HAVE_PROC_OPS
long int old_jiffies;

// ssize_t proc_read(struct file *file, char __user *usr_buf, size_t count, loff t *pos);

int simple_init(void) {
	printk(KERN_INFO "Loading Kernel Module\n");
	
	// prin the GOLDEN
	printk(KERN_INFO "%llu\n", GOLDEN_RATIO_PRIME);
	
	// print HZ and jiffies
	printk(KERN_INFO "%d %ld\n", HZ, jiffies);
	old_jiffies = jiffies;
	return 0;
}

void simple_exit(void) {
	printk(KERN_INFO "%ld\n", gcd(3300, 24));
	printk(KERN_INFO "%ld\n", jiffies);
	printk(KERN_INFO "%ld\n", (jiffies - old_jiffies) / HZ);
	printk(KERN_INFO "Removing Kernel Module\n");
}

module_init(simple_init);
module_exit(simple_exit);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("SIMPLE MODULE");
MODULE_AUTHOR("SGG");

